<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CrateWithdrawalTable extends Migration
{

    public function up()
    {
        //提现账户
        Schema::create('withdrawal_access', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->string('name')->comment('真实姓名');
            $table->string('access')->comment('收款账号');
            $table->tinyInteger('type')->comment('类型 银行卡:1 支付宝:2 微信:3');
            $table->timestamps();
        });
	    //提现申请
	    Schema::create('withdrawal', function (Blueprint $table) {
		    $table->bigIncrements('id');
		    $table->unsignedBigInteger('user_id')->comment('用户ID');
		    $table->string('name')->comment('真实姓名');
		    $table->string('access')->comment('收款账号');
		    $table->string('trade_no')->default(0)-> comment('第三方交易号');
		    $table->tinyInteger('type')->comment('类型 银行卡:1 支付宝:2 微信:3');
		    $table->unsignedDecimal('service_charge', 10, 2)->comment('手续费');
		    $table->unsignedDecimal('amount', 10, 2)->comment('申请金额');
		    $table->unsignedDecimal('arrival_amount', 10, 2)->comment('到账金额');
		    $table->tinyInteger('status')->default(0)->comment('提现状态 提现申请:0 审核通过:1 审核失败:2' );
		    $table->string('remarks')->comment('备注信息');
		    $table->timestamps();
	    });
    }

    public function down()
    {
        Schema::dropIfExists('withdrawal_access');
        Schema::dropIfExists('withdrawal');
    }
}
